home *** CD-ROM | disk | FTP | other *** search
/ PC User 2003 January / Disc 3 / Amethyst.iso / live / usr / share / vim / vim60 / mswin.vim < prev    next >
Encoding:
Text File  |  2002-06-19  |  2.4 KB  |  102 lines

  1. " Set options and add mapping such that Vim behaves a lot like MS-Windows
  2. "
  3. " Maintainer:    Bram Moolenaar <Bram@vim.org>
  4. " Last change:    2001 Oct 30
  5.  
  6. " set the 'cpoptions' to its Vim default
  7. if 1    " only do this when compiled with expression evaluation
  8.   let s:save_cpo = &cpoptions
  9. endif
  10. set cpo&vim
  11.  
  12. " set 'selection', 'selectmode', 'mousemodel' and 'keymodel' for MS-Windows
  13. behave mswin
  14.  
  15. " backspace and cursor keys wrap to previous/next line
  16. set backspace=2 whichwrap+=<,>,[,]
  17.  
  18. " backspace in Visual mode deletes selection
  19. vnoremap <BS> d
  20.  
  21. " CTRL-X and SHIFT-Del are Cut
  22. vnoremap <C-X> "+x
  23. vnoremap <S-Del> "+x
  24.  
  25. " CTRL-C and CTRL-Insert are Copy
  26. vnoremap <C-C> "+y
  27. vnoremap <C-Insert> "+y
  28.  
  29. " CTRL-V and SHIFT-Insert are Paste
  30. map <C-V>        "+gP
  31. map <S-Insert>        "+gP
  32.  
  33. cmap <C-V>        <C-R>+
  34. cmap <S-Insert>        <C-R>+
  35.  
  36. " Pasting blockwise and linewise selections is not possible in Insert and
  37. " Visual mode without the +virtualedit feature.  They are pasted as if they
  38. " were characterwise instead.
  39. if has("virtualedit")
  40.   nnoremap <silent> <SID>Paste :call <SID>Paste()<CR>
  41.   func! <SID>Paste()
  42.     let ove = &ve
  43.     set ve=all
  44.     normal `^"+gPi
  45.     let &ve = ove
  46.   endfunc
  47.   imap <C-V>        <Esc><SID>Pastegi
  48.   vmap <C-V>        "-c<Esc><SID>Paste
  49. else
  50.   nnoremap <silent> <SID>Paste "=@+.'xy'<CR>gPFx"_2x
  51.   imap <C-V>        x<Esc><SID>Paste"_s
  52.   vmap <C-V>        "-c<Esc>gix<Esc><SID>Paste"_x
  53. endif
  54. imap <S-Insert>          <C-V>
  55. vmap <S-Insert>          <C-V>
  56.  
  57. " Use CTRL-Q to do what CTRL-V used to do
  58. noremap <C-Q>        <C-V>
  59.  
  60. " For CTRL-V to work autoselect must be off.
  61. " On Unix we have two selections, autoselect can be used.
  62. if !has("unix")
  63.   set guioptions-=a
  64. endif
  65.  
  66. " CTRL-Z is Undo; not in cmdline though
  67. noremap <C-Z> u
  68. inoremap <C-Z> <C-O>u
  69.  
  70. " CTRL-Y is Redo (although not repeat); not in cmdline though
  71. noremap <C-Y> <C-R>
  72. inoremap <C-Y> <C-O><C-R>
  73.  
  74. " Alt-Space is System menu
  75. if has("gui")
  76.   noremap <M-Space> :simalt ~<CR>
  77.   inoremap <M-Space> <C-O>:simalt ~<CR>
  78.   cnoremap <M-Space> <C-C>:simalt ~<CR>
  79. endif
  80.  
  81. " CTRL-A is Select all
  82. noremap <C-A> gggH<C-O>G
  83. inoremap <C-A> <C-O>gg<C-O>gH<C-O>G
  84. cnoremap <C-A> <C-C>gggH<C-O>G
  85.  
  86. " CTRL-Tab is Next window
  87. noremap <C-Tab> <C-W>w
  88. inoremap <C-Tab> <C-O><C-W>w
  89. cnoremap <C-Tab> <C-C><C-W>w
  90.  
  91. " CTRL-F4 is Close window
  92. noremap <C-F4> <C-W>c
  93. inoremap <C-F4> <C-O><C-W>c
  94. cnoremap <C-F4> <C-C><C-W>c
  95.  
  96. " restore 'cpoptions'
  97. set cpo&
  98. if 1
  99.   let &cpoptions = s:save_cpo
  100.   unlet s:save_cpo
  101. endif
  102.